package com.ljxt.dt.web.servlet.storemanagementservlet;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.ljxt.dt.service.storemanagementservice.StoreService;
import com.ljxt.dt.service.storemanagementservice.impl.StoreServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 唐春劲
 * @version 1.0.0
 * @date 2020-05-18 17:05
 * @copyright 老九学堂
 */

@WebServlet("/deny")
public class DenyChecked extends HttpServlet {
    private StoreService admin = new StoreServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     String order = req.getParameter("receptNo");
       int row =  admin.delete(order);
       ObjectMapper objectMapper  = new ObjectMapper();
       resp.getWriter().write(objectMapper.writeValueAsString(row));
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String order = req.getParameter("data");
        //调用审核拒绝的方法

       int row =  admin.denyCheckOrder(order);

        ObjectMapper objectMapper = new ObjectMapper();
        resp.getWriter().write(objectMapper.writeValueAsString(row));
    }
}
